﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
using System.Data;

namespace GPCSC.Web.AJAX
{
    /// <summary>
    /// savehd 的摘要说明
    /// </summary>
    public class savehd : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Write("Hello World");
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
        #region IHttpHandler 成员

        bool IHttpHandler.IsReusable
        {
            get { throw new NotImplementedException(); }
        }
        /// <summary>
        /// 保存活动
        /// </summary>
        /// <param name="context"></param>
        void IHttpHandler.ProcessRequest(HttpContext context)
        {
            try
            {
               string hdid = context.Request["hdid"].ToString();
                DataSet ds = new DataSet();
                Hashtable hab = new Hashtable();
                hab.Add("@hdid",hdid);
                ds = new SqlReadXml().ReaderDataSet("sel_TB_HDQK_byid",hab);
                if(ds.Tables[0].Rows.Count>0)
                {
                    return;
                }
                else
                {
                   
                    string lgid = context.Request["lgid"].ToString();
                    string NF = context.Request["NF"].ToString();
                    string HDKSDate = context.Request["HDKSDate"].ToString();
                    string HDJSDate = context.Request["HDJSDate"].ToString();
                    string MtxtD_HDDay = context.Request["MtxtD_HDDay"].ToString();
                    Hashtable htable = new Hashtable();
                       
                    htable.Add("HDId", hdid);
                    htable.Add("HDNF", NF);
                    htable.Add("LGid", lgid);
                    htable.Add("HDKSDate", HDKSDate);
                    htable.Add("HDJSDate", HDJSDate);
                    htable.Add("HDDay", MtxtD_HDDay);
                    htable.Add("year",DateTime.Now.Year.ToString());
                    htable.Add("month", DateTime.Now.Month.ToString());
                    SQLServerDAL.databyhtable dtable = new SQLServerDAL.databyhtable();

                    dtable.databyhtables(htable, "add", "TB_HDQK", "", "");
                }
            }
            catch (Exception ee)
            {
                throw ee;
            }

        }

        #endregion
    }
}